package cn.iocoder.yudao.module.vote.dal.mysql.voteuserresultdetail;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.vote.dal.dataobject.voteuserresultdetail.VoteUserResultDetailDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.vote.controller.admin.voteuserresultdetail.vo.*;

/**
 * 投票结果信息详情 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface VoteUserResultDetailMapper extends BaseMapperX<VoteUserResultDetailDO> {

    default PageResult<VoteUserResultDetailDO> selectPage(VoteUserResultDetailPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<VoteUserResultDetailDO>()
                .eqIfPresent(VoteUserResultDetailDO::getUserId, reqVO.getUserId())
                .eqIfPresent(VoteUserResultDetailDO::getResultId, reqVO.getResultId())
                .eqIfPresent(VoteUserResultDetailDO::getMobile, reqVO.getMobile())
                .eqIfPresent(VoteUserResultDetailDO::getContent, reqVO.getContent())
                .eqIfPresent(VoteUserResultDetailDO::getFileUrl, reqVO.getFileUrl())
                .eqIfPresent(VoteUserResultDetailDO::getAssessUrl, reqVO.getAssessUrl())
                .eqIfPresent(VoteUserResultDetailDO::getInfoUrl, reqVO.getInfoUrl())
                .eqIfPresent(VoteUserResultDetailDO::getAppraiseUrl, reqVO.getAppraiseUrl())
                .eqIfPresent(VoteUserResultDetailDO::getRecommendUrl, reqVO.getRecommendUrl())
                .eqIfPresent(VoteUserResultDetailDO::getEvidenceUrl, reqVO.getEvidenceUrl())
                .betweenIfPresent(VoteUserResultDetailDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .orderByDesc(VoteUserResultDetailDO::getId));
    }

    default List<VoteUserResultDetailDO> selectList(VoteUserResultDetailExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<VoteUserResultDetailDO>()
                .eqIfPresent(VoteUserResultDetailDO::getUserId, reqVO.getUserId())
                .eqIfPresent(VoteUserResultDetailDO::getResultId, reqVO.getResultId())
                .eqIfPresent(VoteUserResultDetailDO::getMobile, reqVO.getMobile())
                .eqIfPresent(VoteUserResultDetailDO::getContent, reqVO.getContent())
                .eqIfPresent(VoteUserResultDetailDO::getFileUrl, reqVO.getFileUrl())
                .eqIfPresent(VoteUserResultDetailDO::getAssessUrl, reqVO.getAssessUrl())
                .eqIfPresent(VoteUserResultDetailDO::getInfoUrl, reqVO.getInfoUrl())
                .eqIfPresent(VoteUserResultDetailDO::getAppraiseUrl, reqVO.getAppraiseUrl())
                .eqIfPresent(VoteUserResultDetailDO::getRecommendUrl, reqVO.getRecommendUrl())
                .eqIfPresent(VoteUserResultDetailDO::getEvidenceUrl, reqVO.getEvidenceUrl())
                .betweenIfPresent(VoteUserResultDetailDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .orderByDesc(VoteUserResultDetailDO::getId));
    }

    default VoteUserResultDetailDO selectByResultId(Long resultId){
        return selectOne(new LambdaQueryWrapperX<VoteUserResultDetailDO>()
                .eq(VoteUserResultDetailDO::getResultId, resultId));
    }



}
